package com.web.taglibs;    
import com.web.tree.TreeUtil;    
import javax.servlet.jsp.tagext.TagSupport;    
import javax.servlet.jsp.JspException;    
import java.io.IOException;    
  
public class InitTreeTag extends TagSupport{    
   public int doEndTag() throws JspException {    
    StringBuffer tree = new StringBuffer();    
    tree.append("<script type=\"text/javascript\">\n");    
    tree.append(TreeUtil.createTreeInfo(TreeUtil.retrieveNodeInfos()));    
    tree.append("</script>\n");    
    try{    
     pageContext.getOut().println(tree.toString());    
    }catch(IOException ioe){    
     ioe.printStackTrace();    
    }    
    return super.doEndTag();    
   }    
}

